//=============================================================================
//D Named constructor example
//
// ----------------------------------------------------------------------------
// Copyright 2013 Delcam plc., Birmingham, UK
// ----------------------------------------------------------------------------
//
// History.
// DICC   Who When     What   
// ------ --- -------- --------------------------------------------------------
// 999999 CLH 19/06/13 Written.
//-----------------------------------------------------------------------------

#include "cpp/cppNamedConstructor.h"

// additional includes from 'cpp' library
// includes from PowerINSPECT libraries
// includes from Delcam libraries
#include "utils/ut_assert.h"   // Use assertions!
// includes from other libraries
// system includes
#include <stdio.h>

// types: classes, enums, typedefs

// variables: consts, statics, exported variables (declared extern elsewhere)
// local forward function declarations

#if 0
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#endif

//=============================================================================
cppNamedConstructor::cppNamedConstructor()
//
//D Default constructor to allow run() to be called easily
//
// History.
// DICC   Who When     What   
// ------ --- -------- --------------------------------------------------------
// 999999 CLH 19/06/13 Written.
//-----------------------------------------------------------------------------
{
  UT_CHECKVALID_CLASS;
}

//=============================================================================
cppNamedConstructor::cppNamedConstructor(
  DateDMY,
  int day,
  int month,
  int year
)
  : m_day(day), m_month(month), m_year(year)
//
//D UK constructor.
//
// History.
// DICC   Who When     What   
// ------ --- -------- --------------------------------------------------------
// 999999 CLH 19/06/13 Written.
//-----------------------------------------------------------------------------
{
  UT_CHECKVALID_CLASS;
}

//=============================================================================
cppNamedConstructor::cppNamedConstructor(
  DateMDY,
  int month,
  int day,
  int year
)
  : m_day(day), m_month(month), m_year(year)
//
//D USA constructor.
//
// History.
// DICC   Who When     What   
// ------ --- -------- --------------------------------------------------------
// 999999 CLH 19/06/13 Written.
//-----------------------------------------------------------------------------
{
  UT_CHECKVALID_CLASS;
}

//=============================================================================
cppNamedConstructor::~cppNamedConstructor()
//
//D Destructor.
//
// History.
// DICC   Who When     What   
// ------ --- -------- --------------------------------------------------------
// 999999 CLH 19/06/13 Written.
//-----------------------------------------------------------------------------
{
  UT_CHECKVALID_CLASS;
}

//=============================================================================
void cppNamedConstructor::print() const
//
//D Prints the date in UK format
//
// History.
// DICC   Who When     What   
// ------ --- -------- --------------------------------------------------------
// 999999 CLH 19/06/13 Written.
//-----------------------------------------------------------------------------
{
  UT_CHECKVALID_CLASS;

  printf("%d/%d/%d\r\n", m_day, m_month, m_year);
}

//=============================================================================
void cppNamedConstructor::run()
//
//D Runs the example, creates two dates (this class) and prints them
//
// History.
// DICC   Who When     What   
// ------ --- -------- --------------------------------------------------------
// 999999 CLH 19/06/13 Written.
//-----------------------------------------------------------------------------
{
  UT_CHECKVALID_CLASS;

  cppNamedConstructor uk(xxDMY, 16, 5, 64);
  cppNamedConstructor usa(xxMDY,  5, 16, 64);

  auto fred = new cppNamedConstructor(xxDMY, 16, 5, 6);

  uk.print();

  auto x = 1;

  usa.print();


}
